
function displayValue (value) {
  if (typeof value === 'undefined' || value === null) return ''
  if (typeof value === 'object' ||
    typeof value === 'number' ||
    typeof value === 'string') return value.toString()
  return value
}

function renderProperty (property) {
  var value = displayValue(property)
  if (!value.trim()) {
    return ''
  }
  return '<div class="mbview_property">' +
    '<div class="mbview_property-value">' + value + '</div>' +
    '</div>'
}

// function renderProperties (properties) {
//   return Object.keys(fieldMap).map(propertyName => {
//     const value = properties[propertyName]
//     if (!value) {
//       return ''
//     }
//     return renderProperty(propertyName, value)
//   }).join('')
// }

/* function renderFeatures(features) {
  return features.map(ft => {
    return '<div class="mbview_feature">' + renderProperties(ft) + '</div>';
  }).join('');
} */

function renderPopup (properties) {
  return `<div class="mbview_container"><div class="mbview_popup"><div class="mbview_feature">${renderProperty(properties)}</div></div></div>`
}

export default renderPopup
